import router from "./router";
import useToken from '../store/token'
//此处为路由守护
router.beforeEach((to, from, next) => {
    if (to.path == '/login') {
        next()
    }
    //const token = localStorage.getItem('token')
    //如果没有token，则跳转到登录页面（补充代码，完成此功能）
    const { token } = useToken()
    if (!token) {
        return next('/login')
    }
    next()
})